package com.dd;

import java.util.HashMap;
import java.util.Map;

import com.chantel.tool.db.DBUtil;

public class UserToBuMen {
	private int id;
	private int yuanGongID;
	private int buMenID;
	public int getBuMenID() {
		return buMenID;
	}
	public void setBuMenID(int buMenID) {
		this.buMenID = buMenID;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public int getYuanGongID() {
		return yuanGongID;
	}
	public void setYuanGongID(int yuanGongID) {
		this.yuanGongID = yuanGongID;
	}
	public static boolean intsertNewRelation(int ygID,int bmID)
	{
		DBUtil du = DBUtil.getInstance();
		Map m = new HashMap();
		m.put("YuanGongId", new Integer(ygID));
		m.put("BuMenId", new Integer(bmID));
	
		
		boolean bool_res = du.insertRecord("YuanGongBuMenTable", m);
		if (bool_res)
		{
			System.out.println("insert finish!");			
			
			return true;
		}
		else
		{
			System.out.println("insert error! s");
			return false;
		}		
	}
	public static boolean DeleteUserToBuMen_GuanXi(int userID)
	{
		DBUtil du = DBUtil.getInstance();

		String sql = "delete from YuanGongBuMenTable where YuanGongId = "
				+ ((Integer)(new Integer(userID))).toString();

		boolean bool_res = du.deleteRecords(sql);

		if (bool_res)
		{
			System.out.println("delete user to bu men finish!");			
			
			return true;
		}
		else
		{
			System.out.println("delete user to bu men error! s");
			return false;
		}	
	}
	
	
}